package 实践.class_03;
import java.util.Scanner;
import java.util.Arrays;
//主要知识点：
//1. 字符串转整数：int n = firstLine.charAt(0) - '0';
//2. 字符串数组转整数数组：Integer.parseInt(nums[i]);
//3. 数组排序：Arrays.sort(array);

public class Demo_03 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        // 处理无空格的n和k输入
        String firstLine = scanner.nextLine();
        int n = firstLine.charAt(0) - '0';
        int k = firstLine.charAt(1) - '0';

        int[] array = new int[n];
        String[] nums = scanner.nextLine().split(" ");
        for (int i = 0; i < n; i++) {
            array[i] = Integer.parseInt(nums[i]);
        }

        Arrays.sort(array);
        System.out.println(array[k - 1]);
    }
}
